home *** CD-ROM | disk | FTP | other *** search
- Path: babel.ho.att.com!joe
- From: joe@sanskrit.ho.att.com (Joe Orost)
- Newsgroups: comp.programming,comp.lang.c
- Subject: Bug in SkipList code [Feb'91 C User's Journal]
- Date: 12 Apr 96 13:37:12 GMT
- Organization: AT&T Bell Laboratories, Columbus, Ohio
- Message-ID: <joe.829316232@babel.ho.att.com>
- NNTP-Posting-Host: sanskrit.ho.att.com
-
- I found a bug in the SkipList code [Feb'91 C User's Journal].
-
- In "delete", the following lines are wrong:
-
- while((i = lnode->korl.level) > 1
- && lnode->pointers[i] == NIL)
- {
- lnode->korl.level = --i;
- }
-
- Bug is because lnode->pointers[level] does not exist! The last valid
- entry is lnode->pointers[level-1].
-
- Here is the correct code:
-
- while((i = lnode->korl.level - 1) > 0
- && lnode->pointers[i] == NIL)
- {
- --i;
- }
- lnode->korl.level = i + 1;
-
- regards,
- joe
-
- --
- Full Name: Joseph M. Orost
- EMail: Joseph.Orost@att.com, attmail!orost
- Organization: AT&T Labs: Technology Realization
- SurfaceMail: 943 Holmdel Rd.; Cruz Plaza; Holmdel, NJ 07733
- Phone: +1 (908) 946-1115
- Fax: +1 (908) 946-9146
-